package com.study.web;

import com.study.annotations.LoginRequired;
import lombok.extern.slf4j.Slf4j;
import org.joda.time.DateTime;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 拦截器测试
 */
@Slf4j
@Controller
@ResponseBody
@RequestMapping("/login")
public class InteLoginController {

    @GetMapping("ok")
    @LoginRequired(loginSuccess = true)
    public String isNeedLogin() {
        return new DateTime().toString();
    }

    @GetMapping("fail")
    @LoginRequired(loginSuccess = false)
    public String isNeedLoginNo() {
        return new DateTime().toString();
    }
}
